﻿
@{
    ViewBag.Title = "UsetTree";
}
<script src="@Url.Content("~/Scripts/tree2.js")" type="text/javascript"></script>
<h2>UsetTree</h2>
显示CheckBox:<input id="scb" type="checkbox">
<span id="selectnode" class="btn_normal">获取选中的节点数据</span>

<div id="DictTree"></div>
<script>
    $(function () {
        showMask();
        buildTree();

        $("#scb").click(function () {
            buildTree();
        });

        $("#selectnode").click(function () {
            getSelect();
        });
    });

    var treeProp = new Tree();
    treeProp.ID = "DictTree";
    treeProp.TextClickType = "expand"; //click/expand/
    treeProp.ReturnType = "text:value"; //value/text/text:value
    treeProp.SelectAllChild = true; //单机父节点时是否选中它所有的子节点

    function buildTree() {
        $("#DictTree").html("");
        
        var vck = 0;

        if ($("#scb").prop("checked"))
            vck = 1;

        var url = "../tree.json";

        $.ajax({
            type: "get",
            url: url,
            async: true,
            success: function (response) {
                treeProp.initTree(response, "");
                hideMask();
            }
        });
    }

    function getSelect() {
        alert(treeProp.getSelectNode());
    }
</script>

